package com.cloudlead.fleetAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.fleetAction.BusinessModules;
import com.cloudlead.fleetAction.service.FleetChargeSer;
import com.cloudlead.fleetService.FleetChargeService;
import com.cloudlead.fleetService.vo.BaseFleetChargeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;

/**
 * Created by Will on 2015/12/22.
 */
@Controller
public class FleetChargeActionFactory extends AbstractActionFactory implements FleetChargeService {
    @Autowired
    FleetChargeSer fleetChargeSer;
    public FleetChargeActionFactory( ) {
        super(BusinessModules.FleetCharge);
    }

    @Override
    @Action
    @Order(1)
    @Label("新增车队费用代码")
    public String addFleetChargeSerive(BaseFleetChargeVo baseFleetChargeVo) {
        return fleetChargeSer.addFleetChargeSerive(baseFleetChargeVo);
    }

    @Override
    @Action
    @Order(2)
    @Label("删除车队费用代码")
    public String delFleetChargeSerive(@NotNull @Label("车队费用代码ID")String fleetChargeId) {
        return fleetChargeSer.delFleetChargeSerive(fleetChargeId);
    }

    @Override
    @Action
    @Order(3)
    @Label("编辑车队费用代码")
    public String editFleetChargeSerive(BaseFleetChargeVo baseFleetChargeVo) {
        return fleetChargeSer.editFleetChargeSerive(baseFleetChargeVo);
    }

    @Override
    @Action
    @Order(4)
    @Label("查询车队费用代码")
    public EasyuiGridData findAll(BaseFleetChargeVo baseFleetChargeVo, @NotNull @Label("每页记录条数")int rows,  @NotNull @Label("页码")int page) {
        return new EasyuiGridData(fleetChargeSer.findAll(baseFleetChargeVo,rows,page),"id,baseCompany.companyName baseCompanyName," +
                "code,costName,commet");
    }
}
